#include "CTask.h"
#include <commlib.h>
#include <taskMgr.h>

static int run(struct _ctask_* thes) {
	tsk_run(thes->tsk_id);
	return 0;
}

int construct_task(CTask* thes, int priority, TASK_ENTRY_FUN entry, void* tsk_param, const char* tsk_name) {
	memset(thes, 0, sizeof(*thes));
	thes->run = run;
    thes->tsk_id = tsk_new(priority, entry, tsk_param, tsk_name);
    if(thes->tsk_id < 0) {
        //printf("construct_task failed.\r\n");
        return -1;
    }
	return 0;
}
